<script setup>
import {ref,onMounted} from 'vue'
import http from '/src/utils/http.js'
const list=ref([])

const getUserList=async()=>{
    const response=await http.get('/user/list')
    list.value=response.data
}

onMounted(()=>{
    console.log('请求用户列表数据');
    getUserList();
}
)
</script>

<template>
    <div>
        <h1>个人中心</h1>
        <el-row v-if="list && list.length > 0">
            <el-col :span="4">
                <el-card v-for="user in list" :key="user.id">
                    <p>{{ user.name }}</p>
                    <p>{{ user.gender }}</p>
                    <p>{{ user.birthday }}</p>
                    <p>{{ user.email }}</p>
                    <el-link :href="'/user/'+user.id">查看详情</el-link>
                </el-card>
            </el-col>
        </el-row>
    </div>
</template>